package com.example.service;

import com.example.dao.articleMgmt.ArticleDao;
import com.example.entity.ArticleEntity;
import com.example.entity.query.ArticlePagingQueryFilter;
import com.example.entity.viewModel.BatchUpdateArticleStatusRequest;
import com.example.entity.viewModel.UpdateArticleStatusRequest;
import com.example.common.base.PagingQueryResult;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Date;
import java.util.List;

/**
 * Created by James.H.Fu on 2016/12/17.
 */
@Component
public class ArticleService {
    @Autowired
    private ArticleDao articleDao;

    public int insert(ArticleEntity article) {
        return articleDao.insert(article);
    }

    public int batchInsert(List<ArticleEntity> articleList) {
        return articleDao.batchInsert(articleList);
    }

    public int update(ArticleEntity article) {
        return articleDao.update(article);
    }

    public int batchUpdate(List<ArticleEntity> articleList) {
        return articleDao.batchUpdate(articleList);
    }

    public List<ArticleEntity> queryAll() {
        return articleDao.queryAll();
    }

    public PagingQueryResult<ArticleEntity> pagingQuery(ArticlePagingQueryFilter filter) {
        return articleDao.pagingQuery(filter);
    }

    public int updateStatus(UpdateArticleStatusRequest req) {
        return articleDao.updateStatus(req);
    }

    public int batchUpdateStatus(BatchUpdateArticleStatusRequest req) {
        return articleDao.batchUpdateStatus(req);
    }

    public int delete(int id) {
        return articleDao.delete(id);
    }

    public int batchDelete(Object[] idArray) {
        return articleDao.batchDelete(idArray);
    }

    public int batchDelete(List<Integer> idList) {
        return articleDao.batchDelete(idList);
    }

    public ArticleEntity load(int id) {
        return articleDao.load(id);
    }

    public Integer loadMaxArticleID() {
        return articleDao.loadMaxArticleID();
    }

    public Date loadMaxPublishDate() {
        return articleDao.loadMaxPublishDate();
    }

    public String loadFirstTitle() {
        return articleDao.loadFirstTitle();
    }

    public List<Integer> loadArticleIDList() {
        return articleDao.loadArticleIDList();
    }
}
